{template 'header'}
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">日志中心</a>
        <a>
          <cite>用户分销日志</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" id="search">
            <input class="layui-input" autocomplete="off" placeholder="开始日" name="start_time" id="start_time"
                   value="{$_GPC['start_time']}">
            <input class="layui-input" autocomplete="off" placeholder="截止日" name="end_time" id="end_time"
                   value="{$_GPC['end_time']}">
            <input type="text" name="keyword_fa" placeholder="受益人ID/手机号/真实姓名" autocomplete="off" class="layui-input" id="keyword_fa"
                   value="{$keyword_fa}">
            <input type="text" name="keyword_ch" placeholder="佣金来源ID/手机号/真实姓名" autocomplete="off" class="layui-input" id="keyword_ch"
                   value="{$keyword_ch}">
            <input type="text" name="order_id" placeholder="升级订单ID/接受任务ID" autocomplete="off" class="layui-input" id="order_id"
                   value="{$order_id}">
            <div class="layui-input-inline">
                <select name="yong_type">
                    <option value="" {if $yong_type==''}selected{/if}>请选择佣金来源</option>
                    <option value="0" {if $yong_type=='0'}selected{/if}>任务完成</option>
                    <option value="1" {if $yong_type=='1'}selected{/if}>升级订单</option>
                </select>
            </div>
            <button class="layui-btn" lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
            <span class="x-right" style="line-height:40px">共有数据：{$total} 条</span>
        </form>
    </div>
    <table class="layui-table x-admin">
        <thead>
        <tr>
            <th>
                <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i
                        class="layui-icon">&#xe605;</i></div>
            </th>
            <th>ID</th>
            <th>订单编号</th>
            <th>佣金类型</th>
            <th>受益人信息</th>
            <th>佣金来源用户</th>
            <th>分销金额</th>
            <th>获得佣金</th>
            <th>备注</th>
            <th>时间</th>
        </tr>
        </thead>
        <tbody>
        {if $total==0}

        <tr>
            <td colspan="11" style="text-align: center;">暂无数据</td>
        </tr>

        {else}
        {loop $list $item}
        <tr>
            <td>
                <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='{$item["id"]}'><i
                        class="layui-icon">&#xe605;</i></div>
            </td>
            <td>{$item["id"]}</td>
            <td>{$item["oid"]}</td>
            <td>
                {if $item['yong_type']==0}
                <b style="color: red">任务完成</b>
                {else}
                <b style="color: red">升级订单</b>
                {/if}
            </td>
            <td>用户ID:{$item["user_id"]}<br>手机号:{$item['fa_mobile']}<br>上级ID:{$item['user_pid']}</td>
            <td>用户ID:{$item["sup_id"]}<br>手机号:{$item['ch_mobile']}<br>上级ID:{$item['sup_pid']}</td>
            <td>{$item["fxprice"]}</td>
            <td>{$item["fxyj"]}</td>
            <td>{$item["remark"]}</td>
            <td>{php echo date('Y-m-d H:i:s',$item["create_time"])}</td>
        </tr>
        {/loop}
        {/if}
        </tbody>
    </table>
    <div class="page">
        {$pager}
    </div>
</div>

<script>
    layui.use('form', function () {
        var form = layui.form;

        //监听提交
        form.on('submit(search)', function (data) {
            console.log(data.field)
            var str = '';
            for (var key in data.field) {
                str += key + "=" + data.field[key] + "&";
            }
            var url = '{php echo $this->createWebUrl("user_fx_log")}'
            location.href = url + "&" + str;
            return false;
        });
    });
    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start_time', //指定元素
            type:'datetime'
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end_time', //指定元素
            type:'datetime'
        });
    });
</script>
<script>var _hmt = _hmt || [];
(function () {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>